import 'package:flutter/material.dart';

import '../../YColors.dart';

class HeaderView extends StatelessWidget implements PreferredSizeWidget {
  final String title;
  final bool isShowReturnArrow;
  final Widget leading;
  final Widget bottom;
  final List<Widget> actionList;

  const HeaderView(
      {@required this.title = "",
      this.leading,
      this.isShowReturnArrow = true,
      this.bottom,
      this.actionList});

  @override
  Size get preferredSize => Size.fromHeight(50);

  @override
  Widget build(BuildContext context) {
    return AppBar(
      automaticallyImplyLeading: isShowReturnArrow,
      // 是否显示返回按钮
      leading: leading,
      elevation: 0,
      title: Text(
        title,
        style: TextStyle(color: YColors.t, fontSize: 18),
      ),
      actions: actionList,
      bottom:bottom,
      centerTitle: true,
      // 标题是否居中对齐
      backgroundColor: YColors.l,
    );
  }
}
